package com.jk.dmshopprovider.service;

import com.jk.dmcommon.LybEntity.UserEntity;
import com.jk.dmcommon.entity.EvaEntity;

import com.jk.dmshopprovider.dao.EvaDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @描述
 * @参数 $
 * @返回值 $
 * @创建人 lgf
 * @创建时间 $
 * @修改人和其它信息
 */
@Service
public class EvaService {
    @Resource
    private EvaDao evaDao;

    @Autowired
    private RedisTemplate  redisTemplate;

    public List<EvaEntity> findEva() {
        return evaDao.findEva();
    }

    public void add(EvaEntity ev) {
        UserEntity user = (UserEntity) redisTemplate.opsForHash().get("dmLoginInfo", "loginInfo");
       ev.setUserId(user.getUserId());
        evaDao.add(ev);
    }
}
